<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>资管添加机构列表页面</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<script type="text/javascript">
	var grid = null;
	var _mfrId;
	$(function () {
		   $("#insUseCdNm").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
           	   data: [
	                {  name: 'key', width: 100}, 
	                {  name: 'value', width: 120},
	               ],
	            url:'<%=path%>/rfbase/fribaseinfo/getInsUseCd.do',
	            ajaxType :'GET',
	            slide: false,
	            valueField: 'key', textField: 'value',
	            valueFieldID: 'insUseCd'
           }); 
		   
		var _url = '<%=path%>/rfbase/fribaseinfo/initList.do' ;
	    $("#ligergrid1").ligerGrid({
	    	url: _url,
	    	method : 'get',
	        columns: [
	        	
	            { display: '融资机构名称', name: 'fundRasInsNm', align:'center', width: 300 },
	            { display: '机构编码', name: 'insCode', align:'center', width: 100 },
	            { display: '融资机构用途', name: 'insUseCdNm', align:'center', width: 150 },
	           
	        ],
	        pageSize:10,
	    	checkbox: true,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        rownumbers:true,
	        fixedCellHeight:false,
	        /* isChecked: f_isChecked, onCheckRow: f_onCheckRow, onCheckAllRow: f_onCheckAllRow */
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         var insUseCd = $("#insUseCd").val();
        	 data["insUseCd"]=insUseCd;
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	    
	});

	//融资机构-添加
	function save(){
		var selectedRows = grid.getSelectedRows();
        if (selectedRows.length != 1) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
            return;
        }
       
        Add_navTab('friBaseInfo','资管机构添加页面','<%=path%>/rfbase/fundInsMgr/toModifyNew.do?id='+selectedRows[0].id);    
        cancel();
	}
	
	//格式化时间
	function renderDate(rowdata, index, value) {
		var dateStr = "";
		if (null != value) {
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}

	//关闭
	function cancel() {
		 parent.$(".l-dialog,.l-window-mask").css("display","none");
	}

	function iframeResize() {
		if (parent.mainApp) {
			parent.mainApp.parentTab.onResize();
		}
	}

	
</script>

<body class="iframeBody">
		
			<form id="searchBar">
				<div class="fieldset1 tabel_col tabel_col_1 clearFix">
					<div class="fieldBox col_100">
						<div class="label">机构名称</div>
						<div class="field" >
							<input name="fundRasInsNm" id="fundRasInsNm" type="text"  value="" style="width:300px">
						</div>
					</div>
					<div class="fieldBox col_100">
						<div class="label">机构编码</div>
						<div class="field">
							<input name="insCode" id="insCode" type="text" class="ui-textbox" value="">
						</div>
					</div>
					<div class="fieldBox col_100">
						<div class="label">机构用途：</div>
						<div class="field">
							<input type="text"  name="insUseCdNm" id="insUseCdNm"  class="ui-textbox" >
							<input type="hidden" name="insUseCd" id="insUseCd" data-ligerid="insUseCdNm" value="">
						</div>
					</div>
					<div class="btnsBox" align="center">
						<span id="searchBtn" class="sq-button sq-button-round">查询</span>
					</div>
			</div>
			</form>
		
	
	<div id="ligergrid1" class="sq-grid"></div>
	<div class="btnsBox"  align="center">
			<span id="cr_bsc_info_add_btn_id" class="sq-button sq-button-round" onclick="save();">保存 </span>
			<span id="cr_bsc_info_add_btn_id" class="sq-button sq-button-round" onclick="cancel();">取消</span>
		</div>


</body>
</html>
